package com.example.administrator.maizuofilm.moviedetails.moviecomment;

import com.example.administrator.maizuofilm.moviedetails.bean.DetailsComment;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/**
 * Created by hansen on 2016/7/14.
 */
public class MoviesCommentPresenter implements MoviesCommentContract.commentPresenter {
private MoviesCommentContract.commentView view;
    private MoviesCommentContract.commenModel model;

    public MoviesCommentPresenter(MoviesCommentContract.commentView view,MoviesCommentContract.commenModel model){
        this.view=view;
        this.model=model;
        EventBus.getDefault().register(this);
    }

    @Override
    public void getDetailsComment(String reviewId) {
        model.getDetailsComment(reviewId);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onComm(DetailsComment comm){
        if (comm!=null){
            view.onDetailsComment(comm);
        }else {
            view.onFail("错误");
        }
    }
}
